projects
/
babl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
805c7d1
)
extensions: protect another conversion against /0.0
author
Øyvind Kolås
<pippin@gimp.org>
Fri, 10 Nov 2017 09:44:21 +0000
(10:44 +0100)
committer
Øyvind Kolås
<pippin@gimp.org>
Fri, 10 Nov 2017 09:44:21 +0000
(10:44 +0100)
extensions/gggl.c
patch
|
blob
|
history
diff --git
a/extensions/gggl.c
b/extensions/gggl.c
index d101bef37161cee7d554fc7b87b5ab79b5cde810..cf83988092a3b669645df4b570b83140d0c03940 100644
(file)
--- a/
extensions/gggl.c
+++ b/
extensions/gggl.c
@@
-560,10
+560,16
@@
conv_rgbA16_rgbaF (const Babl *conversion,unsigned char *src, unsigned char *dst
{
float alpha = (((unsigned short *) src)[3]) / 65535.0;
int c;
+ float recip_alpha;
+
+ if (alpha == 0.0f)
+ recip_alpha = 10000.0;
+ else
+ recip_alpha = 1.0/alpha;
for (c = 0; c < 3; c++)
{
- (*(float *) dst) = (*(unsigned short *) src / 65535.0)
/
alpha;
+ (*(float *) dst) = (*(unsigned short *) src / 65535.0)
* recip_
alpha;
dst += 4;
src += 2;
}